import { AsyncShowToast, ToPage } from "../../utils/common"

Page({
  data: {
    // 导航
    nbTitle: '导航',
    // 轮播
    list: [{
      name: '易合抽签',
      background: 'http://static_source.yihcm.com/weixin_mini/card1.png?v=0.0.1',
      href: '/pages/day/day',
      appId: '',
    }, {
      name: '易合手相',
      background: 'http://static_source.yihcm.com/weixin_mini/card2.png?v=0.0.1',
      href: '/pages/palm/palm',
      appId: '',
    }, {
      name: '易合面相',
      background: 'http://static_source.yihcm.com/weixin_mini/card3.png?v=0.0.1',
      href: '/pages/face/face',
      appId: '',
    },],
    circular: false,
    interval: 2000,
    previousMargin: 50,
    nextMargin: 50,
  },
  async onLoad() {},
  // 点击跳转
  async onActive(e: any) {
    try {
      const _index: number = e.currentTarget.dataset.index;
      const _url: string = this.data.list[_index].href;
      await ToPage(_url)
    } catch (error) {
      AsyncShowToast('跳转失败');
    }
  },
})
